﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@model dynamic
@{
    Layout = "";    
    int i = 0,k=0;
    var foo = new List<SelectListItem> { 
        new SelectListItem { Text = "10", Value = "10", Selected = true },
        new SelectListItem { Text = "20", Value = "20" },
        new SelectListItem { Text = "30", Value = "30"},
        new SelectListItem { Text = "50", Value = "50"},
        new SelectListItem { Text = "100", Value = "100"}
    };
    int page                =   1;
    string tbody_display    =   "visible";
    int residuo             =   0;
    int num_records_page    =   Convert.ToInt32(ViewBag.NUM_REG_MOSTRAR);
    int num_total_records   =   Convert.ToInt32(ViewBag.NUM_TOTAL_REG);
    int num_total_page      =   Convert.ToInt32(ViewBag.NUM_TOTAL_PAGINAS);
}
<input type="hidden" id="pagActual" value="1"/>
<input type="hidden" id="numTotalPaginas" value="@num_total_page"/>
<input type="hidden" id="numRegMostrar" value="@num_records_page"/>
<input type="hidden" id="color" value=""/>
<input type="hidden" id="trsito" value=""/>
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
     <tr>
         <td>
             @{
                foreach(var item in  Model) {
                    k++;
                    if (k > 1)
                    {
                        tbody_display = "none";
                    }
                    residuo = k % num_records_page;
                    if (residuo==1)
                     {                         
                        @:<div  style="display:@tbody_display" id="div_page@(page)" >
                            @:<table style="width:100%;" border="1" cellpadding="0" cellspacing="0"  class="tablaDetalle">
                                @:<tr class="tituloDetalleBlue_1" align="center">
                                    <td style="width:15px;">#</td>                                    
                                    <td align="left" style="width:300px;">Nombre de la tabla</td>
                                    <td style="width:140px;">Id compendio</td>                                    
                                    <td style="width:120px;">Fecha Inicio vigencia</td>
                                    <td style="width:120px;">Fecha fin vigencia</td>                                    
                                    <td style="width:100px;">Fecha registro</td>
                                    <td style="width:100px;">Usuario</td>
                                    <td style="width:80px;">Agregar</td>
                                    <td>Actualizar</td>                                       
                                  @:</tr>                                
                         page++;
                     }
                    i++;                    
                     <tr class="@(i%2 != 0 ? "odd" : "even")" align="center" id="trDet1@(i)" >
                         <td>@i</td>
                         <td id="tdDet1@(i)" align="left" class="letraLink8"  onclick="javascript:compendioDetalleDet(this,'trDet1@(i)','@(item.id)');">@item.vNomTabla</td>
                         <td>@item.id</td>
                         <td>@item.dFecIniVig</td>
                         <td>@item.dFecFinVig</td>                         
                         <td>@String.Format("{0:dd/MM/yyyy HH:mm}",item.dtFecReg)</td>
                         <td>@item.usuario</td>
                         <td><span class="letraLinkB8" onclick="javascript:agregarElementoDetalle(this,'@item.id');">Agregar</span></td>
                         <td><span class="letraLinkB8" onclick="javascript:editarCompendio(this,'@item.id');">Actualizar</span></td>
                     </tr>                 
                    if (residuo == 0 || k == num_total_records)
                    {
                       @:</table>
                       @:</div>   
                     }      
                 } 
             }
         </td>
      </tr>
</table>
     @if (num_total_records> 10)
    {
    <table width="100%" border="0" cellpadding="5" cellspacing="0">    
    <tr>
        <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">               
                <tr style="background-color:#e1effb;">
                    <td align="center">
                        <table border="0" cellpadding="0" cellspacing="0" style="width:370px;" >
                        <tbody class="tituloBlue7B">
                            <tr>
                                <td><img src="@Url.Content("~/images/first.gif")"  class="lupita" alt="PRIMERA PÁGINA" onclick="javascript:firstPage('prev');"/></td>
                                <td><img src="@Url.Content("~/images/prev.gif")"  class="lupita" alt="PÁGINA ANTERIOR"  onclick="javascript:nextPage('prev');" /></td>
                                <td class="tituloBlue13">|</td>
                                <td align="right">P&aacute;gina</td>
                                <td>@Html.TextBox("pagaina", null, new {style="width:20px;", value="1"})</td>
                        	    <td align="left"> De&nbsp; @num_total_page</td>
                                <td class="tituloBlue13">|</td>
                                <td><img src="@Url.Content("~/images/next.gif")"  class="lupita" alt="PÁGINA SIGUIENTE" onclick="javascript:nextPage('next');" /></td>
                        	    <td><img src="@Url.Content("~/images/last.gif")"  class="lupita" alt="ÚLTIMA PÁGINA"  onclick="javascript:lastPage('next');" /></td>
                                <td>
                                    @Html.DropDownList("ver", foo, new { onchange="javascript:hizoClic(this);"})
                                </td>
                                <td style="width:100px;" align="right">Mostrando&nbsp;</td>
                                <td>
	    						    <span id="spanInicio">1</span>-<span id="spanFin">@num_records_page</span>&nbsp;de&nbsp;@num_total_records
	    					    </td>
                            </tr>
                        </tbody>
                        </table>
                    </td>                    
                </tr>
            </table>
        </td>
    </tr>
  </table>
  }